//
//  XKMineAboutUsCell.m
//  XKJY
//
//  Created by xuyaguang on 2017/1/12.
//  Copyright © 2017年 xiaokang100. All rights reserved.
//

#import "XKMineAboutUsCell.h"

@interface XKMineAboutUsCell ()
@property (nonatomic, strong) UILabel  *titleLabel;
@property (nonatomic, strong) UIButton *textBtn;
@property (nonatomic, strong) UIImageView *arrowImageView;
@end
@implementation XKMineAboutUsCell

#pragma mark - 自定义cell重写构造方法
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self configArguments];
        [self createSubviews];
        [self addConstraints];
    }
    return self;
}

#pragma mark - 设置自身
- (void)configArguments {
    
}

- (void)textBtnClick:(UIButton *)sender {
    if (self.btnTextSopyBlock) {
        self.btnTextSopyBlock(sender.titleLabel.text);
    }
}


#pragma mark - 创建控件
- (void)createSubviews {
    _titleLabel = [UILabel getLabWithText:@""
                                 textFont:Font_15
                                textColor:BlackColor];
    
    _textBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    _textBtn.titleLabel.font = Font(13);
    _textBtn.titleLabel.textAlignment = NSTextAlignmentRight;
    _textBtn.userInteractionEnabled = NO;
    [_textBtn setTitleColor:GrayColor forState:UIControlStateNormal];
    [_textBtn addTarget:self action:@selector(textBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    
    _arrowImageView = [UIImageView new];
    _arrowImageView.image = [UIImage imageNamed:@"my_con_icon_next"];
    

}
#pragma mark - 添加约束
- (void)addConstraints {

    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20*Scale_W);
        make.top.mas_equalTo(8*Scale_H);
        make.height.mas_equalTo(30*Scale_W);
        make.bottom.mas_equalTo(self.contentView).offset(-8*Scale_H).priorityHigh();
    }];
    
    [self.contentView addSubview:self.arrowImageView];
    [self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.contentView).offset(-20*Scale_W).priorityHigh();
        make.centerY.mas_equalTo(self.titleLabel);
        make.size.mas_equalTo(CGSizeMake(8*Scale_W, 14*Scale_W));
    }];
    
    [self.contentView addSubview:self.textBtn];
    [self.textBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.arrowImageView.mas_left);
        make.centerY.mas_equalTo(self.titleLabel);
    }];
    

    
}

- (void)setTitleString:(NSString *)titleString {
    _titleString = titleString;
    self.titleLabel.text = titleString;
}

- (void)setTextString:(NSString *)textString {
    _textString = textString;
    [self.textBtn setTitle:textString forState:UIControlStateNormal];
    
}

@end
